<?php

namespace fanletter\model;

use fanletter\manager\DesignManager;

/**
 * 
 * Design-class helps identify all the designs and reads the design-information by XML-Configuration.
 * @author Evan
 *
 */
class Design
{
	
	const DEFAULT_DESIGN_FOLDER = '';
		
	private $folder;
	private $title;
	private $pageFile;
	private $contentFile;
	
	public function __construct($folder = self::DEFAULT_DESIGN_FOLDER)
	{
		$this->folder = (String) $folder;
		$this->getDesignInformationByXmlConfig();
	}
	
	/**
	 * 
	 * Returns the folder-name
	 * @return String
	 */
	public function getFolder()
	{
		return $this->folder;
	}
	
	public function getTitle()
	{
		return $this->title;
	}
	
	public function getPageFile()
	{
		return $this->pageFile;
	}
	
	public function getContentFile()
	{
		return $this->contentFile;
	}
	
	/**
	 * reads the configuration from the XML-Config-file and saves it
	 */
	private function getDesignInformationByXmlConfig()
	{
		//XXX: Is that directory right?
		$designConfigFile = '../'.CONFIG_DESIGNPATH.'/'.$this->folder.CONFIG_DESIGNCONFIGFILENAME;
		if (file_exists($designConfigFile));
		{
			$config = new SimpleXMLElement(file_get_contents($designConfigFile));
			// TODO: Fetch design-configuration from XML - So what's the format of that?
		}
		
		$this->title = (String) $title;
		$this->pageFile = (String) $pageFile;
		$this->contentFile = (String) $contentFile;
	}
	
}